package com.pie4cloud.pie.bus.controller;

import com.pie4cloud.pie.bus.service.KafkaTopicService;
import com.pie4cloud.pie.common.core.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequiredArgsConstructor
@RequestMapping("/topic" )
@Api(value = "topic", tags = "topic管理")
public class TopicManageController {
	private final KafkaTopicService kafkaTopicService;

	@ApiOperation(value = "查询topic列表", notes = "查询topic列表")
	@GetMapping("/getTopicList" )
	public R<List<Map<String,String>>> getTopicList(){
		return kafkaTopicService.getTopicList();
	}

	@ApiOperation(value = "删除topic", notes = "删除topic")
	@DeleteMapping("/{topicName}" )
	public R delTopic(@PathVariable String topicName) {
		return kafkaTopicService.delTopic(topicName);
	}
}
